README File for:

"Do External Threats Increase Bipartisanship in the United States? An Experimental Test in the Shadow of China's Rise"

Political Science Research and Methods

Eddy S. F. Yeung, Emory University (ORCID: 0000-0003-2843-6810)
Weifang Xu, Emory University (ORCID: 0000-0001-5877-4285)

September 24, 2024

List of replication files:
- "survey_data.csv": raw dataset for the survey responses
- "main_analysis.R": R script that produces most results reported in the main text (Figures 1-3) and the appendix (Table S3, Figures S1-S15)
- "main_analysis.Rmd": Rmarkdown file that executes the code in "main_analysis.R"
- "main_analysis_log.pdf": log file that runs the R script shown in "main_analysis.Rmd"
- "myrick_external_threat_data_study3.csv": Myrick's dataset for her experimental study (downloaded from https://doi.org/10.7910/DVN/YNVYO2)
- "myrick_analysis.R": R script that produces the results reported in Appendix F (Figures S16-S17)
- "myrick_analysis.Rmd": Rmarkdown file that executes the code in "myrick_analysis.R"
- "myrick_analysis_log.pdf": log file that runs the R script shown in "myrick_analysis.Rmd"
- "stm.R": R script that produces the results reported in Appendix H (Tables S4-S5, Figure S18)
- "stm.Rmd": Rmarkdown file that executes the code in "stm.R"
- "stm_log.pdf": log file that runs the R script shown in "stm.Rmd"

Instruction:
- To complete the replication, the analyst can run the R scripts "main_analysis.R", "myrick_analysis.R", and "stm.R" to obtain the figures and tables
- Alternatively, the analyst can simply run the Rmarkdown files "main_analysis.Rmd", "myrick_analysis.Rmd", and "stm.Rmd" to view the figures and tables in PDFs generated by these Rmarkdown files

------------------------------------------------------------------------------------------------------
Note 1: The replication was done with RStudio version 2023.06.1+524, and with the following R version:

platform       x86_64-apple-darwin17.0     arch           x86_64                      os             darwin17.0                  system         x86_64, darwin17.0          status                                     major          4                           minor          0.1                         year           2020                        month          06                          day            06                          svn rev        78648                       language       R                           version.string R version 4.0.1 (2020-06-06)nickname       See Things Now 

Note 2: The replication was conducted on macOS (Sonoma 14.6.1) with 8 GB 2133 MHz LPDDR3 memory

Note 3: R package versions for this replication are as follows:

tidyverse	v.2.0.0
dplyr		v.1.1.3
readr		v.2.1.2
forcats		v.1.0.0
stringr		v.1.5.0
ggplot2		v.3.4.3
tibble		v.3.2.1
lubridate	v.1.9.3
tidyr		v.1.3.0
purrr		v.1.0.2
estimatr	v.1.0.0
cowplot		v.1.1.1
texreg		v.1.37.5
multcomp	v.1.4.17
interflex	v.1.2.6
stm		v.1.3.6
tm		v.0.7-8